package com.example.appjava.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author sjw
 * @className UserDao
 * @date 2021/6/29 8:55
 * @description: TODO
 */
public interface UserDao extends JpaRepository<User,Integer> {
    List<User> findAllByAge(Integer age);

    @Query("select t1.name from User as t1 join User as t2  on t1.id=t2.id where t1.id in ?1 ")
    String queryName( List<Integer> id);

    List<User> findAllByIdIn(List<Integer> id);
    List<User> findAllByAgeIn(List<Integer> id);
    List<User> findAllByIdInAndAgeIn(List<Integer> id,List<Integer> id1);
}
